package  
{
	import flash.geom.Point;
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.masks.Pixelmask;
	import net.flashpunk.FP;

	public class Bullet extends Entity
	{
		[Embed(source = '/img/bullet.png')] private const IMAGE:Class;
		private var speed:Number;
		
		public function Bullet(px:Number, py:Number,speed:Number,t:String="Bullet") 
		{
			graphic = new Image(IMAGE);
			
			mask = new Pixelmask(IMAGE);
			type = t;
		
			this.speed = speed;
			
			x = px;
			y = py;
			
		}
		
		
		override public function update():void
		{
			
			if (collide("Bullet", x, y))
			{	
				FP.world.remove(collide("Bullet", x, y));
				FP.world.remove(this);
			}
			
			if (x < 0)
				FP.world.remove(this);
			
			x += speed;
		}
	}

}